<template>
  <div class="widget-view">
    <div class="widget_group">
      <div v-if="widget.options.showLabel" class="widget_group_title">
        {{ widget.name }}
      </div>
      <div class="widget_group_body">
        <template v-for="item in widget.list">
          <template v-if="item.type === 'group'">
            <generate-form
              :key="item.key"
              :widget="item"
              :rules="rules"
              :remote="remote"
            />
          </template>
          <template>
            <generate-form-item
              :key="item.key"
              :rules="rules"
              :widget="item"
              :remote="remote"
            />
          </template>
        </template>
      </div>
    </div>
  </div>
</template>

<script>
import GenerateForm from './GenerateForm.vue'
import GenerateFormItem from './GenerateFormItem.vue'

export default {
  name: 'GenerateFormGroup',
  components: {
    GenerateFormItem,
    GenerateForm,
  },
  props: ['widget', 'rules', 'remote', 'data'],
  inject: ['models'],
  data() {
    return {
      key: 11,
    }
  },
}
</script>

<style lang="scss" scoped></style>
